import { random } from "ph-utils";
import { hashDigest } from "ph-utils/crypto_node";

/**
 * 生成用户token
 * @returns token
 */
export function generateToken(username: string) {
	return hashDigest(
		`${random(4)}:${Date.now()}:${username}:${random(4)}`,
		"md5",
	);
}
